﻿#I @"C:\Users\Johan\Desktop\WingBeats\bin\Debug"
#I @"C:\Users\joel.mueller\Documents\Visual Studio 2010\Projects\WingBeats\bin\Debug"
#r "WingBeats"
#r "WingBeats.Xhtml"

open WingBeats.Xml

//type IElement = 
//    abstract member ToNode : unit -> node
//and IBlock   = interface end
//and IInline  = interface end
//
//and IDivChild = interface end
//and Div (attribs, content : #seq<IDivChild>) =
//    interface IElement with 
//        member this.ToNode () = ContentNode("div", [], [])
//
//and IAChild = interface end
//and A (attribs, content : #seq<IAChild>) =
//    interface IElement with 
//        member this.ToNode () = ContentNode("div", [], [])
//    interface IDivChild
//    interface ISpanChild
//
//and ISpanChild = interface end
//and Span (attribs, content : #seq<ISpanChild>) =
//    interface IElement with
//        member this.ToNode () = ContentNode("span", [], [])
//    interface IDivChild
//    interface IAChild
//
//
//let div c = Div ([],c)
//let a c = A([],c)
//let span c = Span([],c)
//
//let myA  = a [ span [] ] // works fine
//let myA2 = a [ div  [] ] // doesn't compile

open WingBeats.Xhtml

let e = XhtmlElement()

let __ = Placeholder ("__")
let (<+) (t : Node) (n : #seq<Node>) = t // logic for adding nodes to a template
let (+>) (n : #seq<Node>) (t : Node) = t // logic for adding nodes to a template

let page = e.Html [ e.Head [ __ ]; e.Body [ __ ] ]

let body = e.Body [ e.Div "#page" [ e.Div "#header"       [ __ ] 
                                    e.Div "#main-content" [ __ ]
                                    e.Div "#footer"       [ __ ]
                                  ]]
let head = e.Head [ e.Title [ __ ]
                    __
                    __
                  ]

let header        = NoNode (* ... header content ... *) 
let mainContent   = NoNode (* ... main   content ... *)
let footerContent = NoNode (* ... footer content ... *)

let result =
    [ head <+ [ e.Str "en titel"
                e.Script [ ("src", "/scripts/main.js") ] []
                NoNode
              ]
      body <+ [ header; mainContent; footerContent ]
    ] +> page

    // I don't know if it's a good idea to have both +> and <+, maybe it's just confusing.
